package com.zt.springcloud.controller;

import cloud.zt.springboot.utils.TokenUtils;
import com.zt.springcloud.entity.Product;
import com.zt.springcloud.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @author RedReins
 * @version 1.0
 * @description: TODO
 * @date 2021/9/4 15:02
 */

@RestController
public class ProductController {
    @Autowired
    private ProductService productService;


    @RequestMapping("/foodProduct/getAllFoodItem")
    public Set<Product> getAllFoodItem(){
        System.out.println(TokenUtils.getToken());

        return productService.getAllFoodItem();
    }

    @GetMapping("/item/info/{productId}")
    public Product getItemInfo(@PathVariable("productId") Long productId){
        return productService.getItemInfo(productId);
    }
}
